#ifndef GRAPHICS_H_
#define GRAPHICS_H_

// INCLUDES //
#include "SDL/SDL_image.h"
#include "SDL/SDL_ttf.h"
#include "surface.h"
#include <string>
#include <vector>
//////////////

using namespace std;

class Point
{
public:
	int x;
	int y;
};

class Color
{
public:
	Color()
	{
		r = g = b = 255;
	}
	
	Color(int r, int g, int b)
	{
		this->r = r; this->g = g; this->b = b;
	}
	
	Uint32 ToUint32()
	{
		Uint32 color;
		color = r;
		color <<= 8;
		color += g;
		color <<= 8;
		color += b;
		return color;
	}
	
public:
	Uint8 r;
	Uint8 g;
	Uint8 b;
};

#define ALPHA_COLOR 			Color(255, 0, 255)
#define COLOR_BLACK 			Color(0, 0, 0)
#define COLOR_WHITE 			Color(255, 255, 255)
#define COLOR_RED 				Color(255, 0, 0)
#define STANDARD_TOOLTIP_WIDTH	300
#define TOOLTIP_RADIUS			5

enum Font
{
	FONT_KNIGHT = 0,
	FONT_CICLE_FINA,
	FONT_DEJA_VU_SANS,
	FONT_DEJA_VU_SANS_BOLD
};

enum FontSize
{
	FONT_SIZE_XSMALL = 4,
	FONT_SIZE_SMALL = 8,
	FONT_SIZE_MEDIUM = 12,
	FONT_SIZE_NORMAL = 18,
	FONT_SIZE_LARGE = 25
};

enum TextAlignment
{
	ALIGNMENT_LEFT = 1,
	ALIGNMENT_MIDDLE = 2,
	ALIGNMENT_RIGHT = 4,
	ALIGNMENT_TOP = 8,
	ALIGNMENT_CENTER = 16,
	ALIGNMENT_BOTTOM = 32
};

/**
* Graphics utility functions.
* 
* @author dfoelber
**/
class Graphics
{
public:
	/**
	* Singleton accessor
	* 
	* @return Singleton instance
	**/
	static Graphics* GetGraphics();
	
	/**
	* Deconstructor
	**/
	~Graphics();
	
	void Load();
	
	void CreateStandardTooltip( string tooltip, Surface** surface, Surface** background, int width = STANDARD_TOOLTIP_WIDTH );
	
	void DrawFont( Surface* surface, string s, Font font, FontSize size, Color c, int x, int y, int alpha = SDL_ALPHA_OPAQUE );
	
	void DrawFont( Surface* surface, string s, Font font, FontSize size, Color c, int x, int y, int width, int height, int alignment, int alpha = SDL_ALPHA_OPAQUE );
	
	void GetFontSize( Font font, string s, FontSize size, int* w, int* h );
	
	TTF_Font* GetFont( Font font, FontSize size );
	
private:
	/**
	* Private constructor
	**/
	Graphics();
	
private:
	/**
	* Singleton instance
	**/
	static Graphics* 			instance;
	
	/**
	* All of the fonts
	**/
	vector<vector<TTF_Font*> >	fonts;
};

#endif /*GRAPHICS_H_*/
